<div id="data-popover" class="popover fade bottom in" ng-show="newData" ng-controller="DataCtrl">
  <div class="arrow"></div>

  <h3 class="popover-title">
    New Data Source
    <a class="close" ng-click="cancel()">×</a>
  </h3>

  <div class="inner">
    <vde-property label="Name" type="text" item="dMdl.src" property="name"
                  ng-model="dMdl.src.name" nodrop="1" nochange="1" style="full"></vde-property>

    <vde-property label="From" style="full" transclude="1" nochange="1">
      <label><input type="radio" ng-model="dMdl.from" value="url" /> URL</label>

      <label><input type="radio" ng-model="dMdl.from" value="values" /> Raw Values</label>
    </vde-property>

    <vde-property label="Url" type="text" item="dMdl.src" property="url" ng-show="dMdl.from == 'url'"
                  ng-model="dMdl.src.url" nodrop="1" nochange="1" style="full"></vde-property>

    <vde-property label="Values" ng-show="dMdl.from == 'values'" nodrop="1"
                  nochange="1" style="full" transclude="1">

      <textarea ng-model="dMdl.values"></textarea>
    </vde-property>

    <vde-property label="Format" type="select" options="dMdl.formats" item="dMdl.src"
                  property="format.type" ng-model="dMdl.src.format.type"
                  nodrop="1" nochange="1" style="full"></vde-property>

    <br clear="all" />

    <a class="btn btn-mini" ng-show="!dMdl.src.values" ng-click="cancel()">Cancel</a>

    <a class="btn btn-mini" ng-class="{disabled: dMdl.isLoading}" ng-show="!dMdl.src.values" ng-click="loadValues()">Load</a>

    <div ng-show="dMdl.src.values">
      <h4>Parsings</h4>

      <div ng-repeat="(field, parse) in dMdl.src.format.parse track by $index">
        <vde-property label="{{field}}" type="select" options="dMdl.parsings"
                      item="dMdl.src.format.parse[field]"
                      property="dMdl.src.format.parse[field]"
                      ng-model="dMdl.src.format.parse[field]"
                      nodrop="1" nochange="1" style="half"></vde-property>
      </div>
    </div>

    <br clear="all" />

    <a class="btn btn-mini" ng-show="dMdl.src.values" ng-click="cancel()">Cancel</a>

    <a class="btn btn-mini" ng-show="dMdl.src.values" ng-click="add()">Add Data Source</a>

  </div>
</div>